package link.api;

import java.util.Map;
import link.model.AgentInfoVo;
import link.model.CommonResultVo;
import link.model.ConfigInfoVo;
import link.model.TokenInfoVo;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import org.an.proj.contacts.model.response.Result;
import retrofit2.Call;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import rx.Observable;

/**
 * 创建时间：2016年12月01日21:17 <br>
 * 作者：fuchaoyang <br>
 * 描述：登录，uc等相关api
 */

public interface LinkApi {
  /**
   * 登陆
   */
  @POST("user/login.json?") @FormUrlEncoded Observable<Result<AgentInfoVo>> userLogin(
      @Field("channel") String channel);

  /**
   * App登录接口
   */
  @POST("uc/user/login.json") @FormUrlEncoded Observable<Result<TokenInfoVo>> appLogin(
      @FieldMap Map<String, String> params);

  /**
   * App登录接口
   */
  @POST("uc/user/login.json") @FormUrlEncoded Call<Result<TokenInfoVo>> appLogin2(
      @FieldMap Map<String, String> params);

  /**
   * 获取首页等配置信息
   */
  @GET("common/index/config.json?") Observable<Result<ConfigInfoVo>> getConfigInfoVo();

  /**
   * 获取短信验证码
   */
  @POST("uc/user/sms.json") @FormUrlEncoded Call<Result> getSmsAuthCode(
      @FieldMap Map<String, String> params);

  /**
   * 获取语音验证码
   */
  @POST("uc/user/voice.json") @FormUrlEncoded Call<Result> getVoiceAuthCode(
      @FieldMap Map<String, String> params);

  /**
   * 获取新房首页数据
   */
  @GET("newhouse/homepage.json") Call<Result> getHomePageData();

  /**
   * 修改经纪人头像
   */
  @Multipart @POST("user/avatar/modify.json") Call<Result<CommonResultVo>> setAvatar(
      @PartMap Map<String, RequestBody> params);

  /**
   * 录带看:上传照片
   */
  @Multipart @POST("newhouse/visit/image/upload.json") Call<Result> uploadImage(
      @PartMap Map<String, RequestBody> params);

  @Multipart @POST("newhouse/visit/image/upload.json") Call<Result> uploadImage(
      @Part MultipartBody.Part part);
}
